<template>
  <div class="{table_name}">
    <page-content-new
      ref="pageContentRef"
      :contentTableConfig="contentTableConfig"
      pageName="{table_name}"
      tableName="{table_name}"
      @newBtnClick="handleNewData"
      @editBtnClick="handleEditData"
      @filterBtnClick="handleFilterClick"
    >
    </page-content-new>
    <page-modal ref="pageModalRef" :defaultInfo="defaultInfo" :modalConfig="modalConfig" pageName="{table_name}">
    </page-modal>
    <page-filter
      ref="pageFilterRef"
      :searchFormConfig="filterConfig"
      @resetBtnClick="handleResetClick"
      @queryBtnClick="handleQueryClick"
    ></page-filter>
  </div>
</template>

<script lang="ts" setup>
import { PageContentNew } from '@/components/page-content'
import { PageFilter } from '@/components/page-search'
import { usePageFilter } from '@/hooks/use-page-filter'
import { usePageModal } from '@/hooks/use-page-modal'
import { contentTableConfig } from './config/content.config'
import { modalConfig } from './config/modal.config'
import { filterConfig } from './config/filter.config'

const [pageModalRef, defaultInfo, handleNewData, handleEditData] = usePageModal()

const { pageFilterRef, pageContentRef, handleResetClick, handleQueryClick } = usePageFilter()

const handleFilterClick = () => {
  console.log('click Filter')
  pageFilterRef.value.dialogVisible = true
}
</script>

<style scoped lang="less"></style>
